SET SERVEROUTPUT ON

DECLARE

--Declaring the variables for storing the data from the cursor.
table_name dba_tables.table_name%TYPE;
owner_name dba_tables.owner%TYPE;
table_space_name dba_tables.tablespace_name%TYPE;
last_analyzed dba_tables.last_analyzed%TYPE;

	--Creating the Cursor to get the details from dba_tables
	CURSOR g_statistics IS
		SELECT table_name,owner,tablespace_name,last_analyzed
		FROM dba_tables WHERE table_name='EMPLOYEE';

BEGIN
	OPEN g_statistics;
	LOOP
		FETCH g_statistics INTO table_name,owner_name,table_space_name,last_analyzed;
		EXIT WHEN g_statistics%NOTFOUND;
		
		--Displaying the Details of the EMPLOYEE Table
		DBMS_OUTPUT.PUT_LINE('Gathering Statistics of Employee table');
		DBMS_OUTPUT.PUT_LINE('--------------------------------------');
		DBMS_OUTPUT.PUT_LINE('                                      ');
		DBMS_OUTPUT.PUT_LINE('TABLE_NAME: ' ||table_name );
		DBMS_OUTPUT.PUT_LINE('OWNER_NAME: ' || owner_name);
		DBMS_OUTPUT.PUT_LINE('TABLESPACE_NAME: ' || table_space_name);
		DBMS_OUTPUT.PUT_LINE('LAST_ANALYZED: '|| last_analyzed);
	END LOOP;
	CLOSE g_statistics;
END;
/
	